<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<body>
<form class="layui-form white-bg radius" action="student/updateCertificate" method="post" style="margin: 20px auto; text-align:center; margin-top: 40px;">
	<input type="hidden" name="certificateuuid" value="${model.certificateuuid}" id="certificateuuid">
	<input type="hidden" name="id" value="${model.id}" id="id">
	<div class="layui-upload-drag" id="fileuuidhtmlup">
		<c:if test="${model.certificateuuid==null }">
			<i class="layui-icon">&#xe67c;</i>
			<p>点击上传，或将文件拖拽到此处</p>
		</c:if>
		<c:if test="${model.certificateuuid!=null }">
			<img alt="" src="download?uuid=${model.certificateuuid }" width="100px" height="100px" title="点击重新选择">
		</c:if>
	</div>
</form>

<script>
    layui.use('upload', function(){
        var upload = layui.upload;
        //执行实例
        var uploadInst = upload.render({
            elem: '#fileuuidhtmlup' //绑定元素
            ,url: 'toFilesave' //上传接口
            ,done: function(res){
                if(res.success){
                	$("#certificateuuid").val(res.msg);
                	$("#fileuuidhtmlup").html('<img alt="" src="download?uuid='+res.msg+'" width="100px" height="100px" title="点击重新选择">' );
                }else{
                	layer.open({
                		title: '上传失败'
                		,content: res.msg
                		,time: 2000
                	});   
                }
            }
            ,error: function(){
                
            }
        });
    });
</script>

</body>
